/**
 * Created by Administrator on 2018/2/23 0023.
 */

storePic = function (value, row, index) {
    var img = row.picture;
    var imgUrl = "";
    if (img != null && img != '') {
        imgUrl = File_Download_Url + img;
        return [
            '<image src=' + imgUrl + ' style="width:80px;height:80px" />'
        ].join('');
    } else {
        return [
            '<image src=' + $().AbsUrlParse("/static/images/no.png") + ' style="width:80px;height:80px" />'
        ].join('');
    }
};

operateFormatter = function () {
  return[
      '<a class="agree" href="javascript:void(0)" >同意审核</a>' +
      '&nbsp;&nbsp;'
  ].join()
};

operateEvents = {
    'click .agree':function (e, value, row) {
        showModel("addBusinessPicture-div", function () {
            $("#id").val(row.id);
        })
    }
};

/**
 * 修改按钮事件
 */
bindClick("button[data-event=submit-replaceBusinessPicture]", function () {
    var imag = $("#image").attr("img-path");
    if (imag == null || imag == "") {
        hint("请上传图片");
        return;
    }
    $("#pic").val(imag);

    var form = $("#updateBusinessReplaceFrom");
    var param = form.formToArray();
    $.post($().AbsUrlParse('/web/business/replaceBusinessPicture'), param, function (res) {
        if (res.state && res.res.code == 40000) {
            hint('设置成功');
            //关闭model方法
            closeModel('addBusinessPicture-div');
            var table = $("#table");
            table.bootstrapTable("refresh");
        } else {
            if (res.state == false) {
                hint(res.msg);
            } else {
                hint(res.res.msg);
            }
        }
    });
});

var queryRecomBus = function () {
    var name = $("#busName").val();
    var url = $().AbsUrlParse("/web/business/queryRecommendBusiness?businessName=" + name);
    var table = $("#table");
    table.bootstrapTable("refresh", {url: url});
};